# NAME:
#   makefile for msmtp-notify
#
# RCSID:
#   Copyright (C) 2011 Du Yang <duyang.seu@gmail.com>
#   All Rights Reserved
#
# NOTES:
#   Read the INSTALL file before running make.

# Don't change these.
PROJECT	=msmtp-notify
VERSION	=1.02
SRCS	=Makefile README INSTALL msmtp-notify.c msmtp-notify.man

# Override these on the make command line, as described in INSTALL.
CFLAGS	?=-Wall -O3
LDFLAGS	?=-s
PREFIX	?=/org
GZIP	?=gzip -9
ZIPEXT	?=.gz
ROFFARG	?=-rLL=64n

all: ${PROJECT} ${PROJECT}.1${ZIPEXT}

${PROJECT}: ${PROJECT}.c
	${CC} ${CFLAGS} -o ${PROJECT} ${PROJECT}.c ${LDFLAGS}

${PROJECT}.1${ZIPEXT}: ${PROJECT}.man
	nroff -man ${ROFFARG} ${PROJECT}.man | ${GZIP} > ${PROJECT}.1${ZIPEXT}

install: all
	install -c -m755 ${PROJECT} ${PREFIX}/bin 

install-man: all
	install -c -m644 ${PROJECT}.1${ZIPEXT} ${PREFIX}/man/man1 

clean:
	rm -f ${PROJECT} ${PROJECT}.1* ${PROJECT}-${VERSION}.tar.gz

dist:	${PROJECT}-${VERSION}.tar.gz

${PROJECT}-${VERSION}.tar.gz: ${SRCS}
	rm -f ${PROJECT}-${VERSION}.tar.gz
	chmod 444 ${SRCS}
	tar -czvf ${PROJECT}-${VERSION}.tar.gz ${SRCS}
	chmod 444 ${PROJECT}-${VERSION}.tar.gz
	chmod o-rwx ${SRCS}
